#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->label->setText(QString("二月红前来求药"));

    // connect(ui->pushButton_Accept,&QPushButton::clicked,this);

    srand(time(nullptr));
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_Accept_clicked()
{
    ui->label->setText("女神女神，嘴一个。");
}

// 不够快，还要按完弹回来再。
void Widget::on_pushButton_reject_clicked()
{
    // int width = this->geometry().width();
    // int height = this->geometry().height();

    // int x = rand() % width;
    // int y = rand() % height;

    // ui->pushButton_reject->setGeometry(x,y,ui->pushButton_reject->width(),ui->pushButton_reject->height());
}

// 按都不用按下。
void Widget::on_pushButton_reject_pressed()
{
    int width = this->geometry().width();
    int height = this->geometry().height();

    int x = rand() % width;
    int y = rand() % height;

    ui->pushButton_reject->setGeometry(x,y,ui->pushButton_reject->width(),ui->pushButton_reject->height());
}

